package com.reus.core.util.proxy;

/**
 * description:
 * copyright: Copyright (c) 2018-2021
 * company: iSysCore Tech. Co., Ltd.
 *
 * @author liuxq@isyscore.com
 * @version 1.0
 * @date 2021-10-11 14:52:44
 */
public class ProxyTest {
    public static void main(String[] args) {
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");
        // 实例化目标对象
        HelloService userService = new HelloServiceImpl();

        // 实例化InvocationHandler
        MyInvocationHandler invocationHandler = new MyInvocationHandler(userService);

        // 根据目标对象生成代理对象
        HelloService proxy = (HelloService) invocationHandler.getProxy();

        // 调用代理对象的方法
        proxy.hello();
    }
}
